// #include <bits/stdc++.h>
#include <locale>
#include <string>
#include "iostream"

using namespace std;
//
struct dog {
  string name;  // 名字
  string kind;  // 品种
  // bool gender; // 性别：公狗1，母狗0
  // bool kacha;  // 是否绝育（咔嚓）
  int age;  // 年龄 year
  // int weight;  // 体重 kg
  // int height;  // 身高 cm
};  // 结尾有分号！

void eg1() {
  // eg1.统计宠物信息：结构体的定义与使用  1, 0, 3, 25, 56
  dog tudou = {"土豆", "土松", 3};
  dog digua;
  digua.name = "地瓜";
  digua.kind = "柯基";
  // digua.gender = 1;
  // digua.kacha = 1;
  digua.age = 3;
  // digua.weight = 10;
  // digua.height = 26;
  cout << tudou.name << endl;
  cout << digua.name << endl;
  digua.name = "大地瓜";
  cout << digua.name << endl;
  // eg2.结构体数组
  // dog dog_array[4] = {
  //     tudou,
  //     digua,
  //     {"小土豆", "土松", 0, 0, 0.5, 10, 25},
  //     {"小地瓜", "柯基", 0, 1, 0.5, 5, 13},
  // };
  // for (int i = 0; i < 4; i++) {
  //   cout << "姓名：" << dog_array[i].name << endl;
  // }
}

// 比较运动员成绩：姓名、抓举、挺举、年龄
struct athlete {
  string name;        // 姓名
  float weight;       // 体重
  float score_catch;  // 抓举成绩
  float score_stand;  // 挺举成绩
  float score;        // 总成绩
};

void eg2() {
  athlete a1 = {"张三", 82.5, 9.0, 8.5};
  athlete a2 = {"李四", 79.8, 8.5, 9.0};
  a1.score = a1.score_catch + a1.score_stand;
  a2.score = a2.score_catch + a2.score_stand;
  if (a1.score > a2.score) {
    cout << a1.name << " 获胜！" << endl;
  } else if (a1.score < a2.score) {
    cout << a2.name << " 获胜！" << endl;
  } else {
    if (a1.weight > a2.weight) {
      cout << a1.name << " 获胜！" << endl;
    } else if (a1.weight < a2.weight) {
      cout << a2.name << " 获胜！" << endl;
    } else {
      cout << "平局！" << endl;
    }
  }
}

// 结构体的嵌套
struct student {
  string name;
  int age;
  struct {
    int chinese;
    int math;
    int english;
  } score;
};
struct teacher {
  string name;
  int age;
  student stus[6];
};
// eg3
int main() {
  // SetConsoleOutputCP(CP_UTF8);
  // locale loc("zh_CN.UTF-8");
  setlocale(LC_ALL, "zh_CN.UTF-8");
  eg1();
  // cout.imbue(loc);
  // gougou();
  // cout << "你好 世界！";
  return 0;
}